Technical Q&A
ME07 - Finding the VM Backing Store (6-February-98)
Q
I'm writing a backup program and I'd like to find the VM Storage file, so as to avoid
backing it up.
How do I do this?
A
The best way of finding the current VM Storage file is to use a previously undocumented
Gestalt selector:
enum {
gestaltVMBackingStoreFileRefNum = 'vmbs'
};
The result of this selector is an file reference number to the active "VM Storage" file.
You can convert that reference number to an FSSpec by calling PBGetFCBInfoSync ,
as shown below:
static OSErr FindVMStorage(FSSpec *fss)
{
OSErr err;
long gestaltResult;
FCBPBRec fcbPB;
err = Gestalt(gestaltVMBackingStoreFileRefNum, &gestaltResult);
if (err == noErr) {
fcbPB.ioNamePtr = fss->name;
fcbPB.ioVRefNum = 0;
fcbPB.ioRefNum = gestaltResult;
fcbPB.ioFCBIndx = 0;
err = PBGetFCBInfoSync(&fcbPB);
}
if (err == noErr) {
fss->vRefNum = fcbPB.ioFCBVRefNum;
fss->parID = fcbPB.ioFCBParID;
}
return err;
}
-- Quinn "The Eskimo!"
Worldwide Developer Technical Support
Technical Q&A
Previous Question | Next Question
Contents
To contact us, please use the Contact Us page.
|